<template>
  <div class="order_details">
    <el-container class="base_details_container">
      <el-header>
        <el-page-header @back="back" :icon="ArrowLeft">
          <template #title>
            返回
          </template>
          <template #content>
            <span class="text-large font-600 mr-3">订单记录</span>
          </template>
        </el-page-header>
      </el-header>
      <el-main>
        <el-tabs v-model="activeName" @tab-change="tabChange" type="border-card" class="base_details_tabs">
          <el-tab-pane name="goods">
            <template #label>
              <el-badge>
                <span>商品订单</span>
              </el-badge>
            </template>
            <div class="content">
              <GoodsOrder v-if="activeName == 'goods'" type="member" routeName="membergoodsorder"></GoodsOrder>
            </div>
          </el-tab-pane>
          <el-tab-pane name="travel">
            <template #label>
              <el-badge>
                <span>旅行订单</span>
              </el-badge>
            </template>
            <div class="content">
              <TravelOrder v-if="activeName == 'travel'" type="member" routeName="membertravelorder"></TravelOrder>
            </div>
          </el-tab-pane>
          <el-tab-pane name="hotel">
            <template #label>
              <el-badge>
                <span>酒店订单</span>
              </el-badge>
            </template>
            <div class="content">
              <HotelOrder v-if="activeName == 'hotel'" type="member" routeName="memberhotelorder"></HotelOrder>
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-main>
      <el-footer>
        <el-button @click="back">取消</el-button>
      </el-footer>
    </el-container>
  </div>
</template>

<script setup>
import { ArrowLeft } from '@element-plus/icons-vue'
import GoodsOrder from "@com/order/GoodsOrder.vue"
import TravelOrder from "@com/order/TravelOrder.vue"
import HotelOrder from "@com/order/HotelOrder.vue"

import { ref } from "vue";
import useRoute from "@util/router";

const route = useRoute()

const activeName = ref("goods");

function tabChange(val) {
  route.push({ name: `member${val}order`, query: { login: route.query().login } });
}

function back() {
  route.push({ name: 'membermanager'})
}
</script>

<style lang="scss" scoped>
.order_details {
  height: 100%;
}

::v-deep input::-webkit-outer-spin-button,
::v-deep input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
}

::v-deep input[type='number'] {
  -moz-appearance: textfield !important;
}
</style>